/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package name_service;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import mware_lib.NameService;

/**
 * @author Gortex
 */
public class NameServiceImpl extends NameService {

    private Map<String, Object> dictonary;

    protected NameServiceImpl() {
        this.dictonary = new ConcurrentHashMap();
    }

    @Override
    public void rebind(Object servant, String name) {
        dictonary.put(name, servant);
    }

    @Override
    public Object resolve(String name) {
        if (dictonary.containsKey(name)) {
            return dictonary.get(name);
        } else {
            return null;
        }
    }
}
